package API.DAY6.exception;

public class TryCatchDemo {
    public static void main(String[] args) {
        System.out.println("程序开始");
        try{
//            String str = null;
//            System.out.println(str.length());

            String str2 = "abc";
            System.out.println(str2.charAt(5));
        }
//        catch (NullPointerException e){
//            System.out.println("空指针异常");
//        }catch (StringIndexOutOfBoundsException e){
//            System.out.println("索引越界异常");
//        }
        catch (Exception e){
            System.out.println("出错啦！");
        }
        System.out.println("程序结束");
    }
}
